import React, { useState, lazy, Suspense } from "react";
import {
  LaptopOutlined,
  NotificationOutlined,
  UserOutlined,
} from "@ant-design/icons";
import { Breadcrumb, Layout } from "antd";
import styles from "./index.module.less";
import "./App.less";
import { Route, Routes, Navigate, useRoutes } from "react-router-dom";
import RoutesList from "./route";

import Home from "./pages/home";
import HomeMain from "./pages/home/main";
import TestPage from "./pages/testPage";

const MyMenu = lazy(() => import("./component/Menu"));

const { Header, Content, Sider } = Layout;

const App = () => {
  const [collapsed, setCollapsed] = useState(false);
  const toggleCollapsed = () => {
    setCollapsed(!collapsed);
  };

  return (
    <Layout className={styles.main_home}>
      <Header className={styles.header}>
        <h1>node react 接口测试</h1>
      </Header>
      <Content className={styles.content}>
        {/* <Breadcrumb> */}
        {/* <Breadcrumb.Item>Home</Breadcrumb.Item>
          <Breadcrumb.Item>List</Breadcrumb.Item>
          <Breadcrumb.Item>App</Breadcrumb.Item> */}
        {/* </Breadcrumb> */}
        <Layout className={styles.NeiView}>
          <Sider
            theme="light"
            className={styles.sider}
            collapsed={collapsed}
            width={200}
          >
            <div className={styles.sider_top} onClick={toggleCollapsed}></div>
            <MyMenu></MyMenu>
          </Sider>
          <Content className={styles.main_content}>
            <Suspense fallback={<h1>loading...</h1>}>
              <RoutesList></RoutesList>
              {/* <Routes>
                <Route path="/home" element={<Home />}>
                  <Route path="index" element={<HomeMain />}></Route>
                </Route>
                <Route path="/" element={<Navigate to={"/home"} />}></Route>
                <Route path="/test" element={<TestPage />}></Route>
              </Routes> */}
            </Suspense>
          </Content>
        </Layout>
      </Content>
    </Layout>
  );
};
export default App;
